﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>填充下拉框</title>
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/easyUI145/jquery.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/easyUI145/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../Comm/Gener.js" type="text/javascript"></script>
    <script src="DDLBar.js" type="text/javascript"></script>
    <script src="../../CCFlowEnum.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {

            InitBar("DDLs");
            var html = "";
            //查询出来数据.
            //更新节点表单类型.
            var frmID = GetQueryString("FK_MapData");
            var refPK = GetQueryString("RefPK");
            var keyOfEn = GetQueryString("KeyOfEn");
            var thisPK = refPK + "_FullData";

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner_MapExt");
            handler.AddPara("FK_MapData", frmID);
            handler.AddPara("KeyOfEn", keyOfEn);
            handler.AddPara("MyPK", thisPK);
            var data = handler.DoMethodReturnString("TBFullCtrlDDL_Init");

            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            }

            data = JSON.parse(data);
            mapdtls = data;

            if (data.length == 0) {

                $("#doc").html("<h3>没有要填充的下拉框字段.</h3>");
                return;
            }

            var html = "<table style='width:99%;'>";
            for (var i = 0; i < data.length; i++) {
                var mapAttr = data[i];
                if (data[i].KeyOfEn == keyOfEn)
                    continue;
                html += "<tr>";
                html += "<th>下拉框:" + mapAttr.KeyOfEn + " - " + mapAttr.Name;
                html += "</tr>";

                html += "<tr>";
                html += "<td>";
                html += '<textarea rows=4 name=TB_' + mapAttr.KeyOfEn + '  name=TB_' + mapAttr.KeyOfEn + ' style="width:98%;" > ' + mapAttr.DefVal + '</textarea>';
                html += "</td>";
                html += "</tr>";

            }

            $("#doc").html(html);
            return;
        });
        function Save() {

            var str = "";
            var frmID = GetQueryString("FK_MapData");
            var refPK = GetQueryString("RefPK");

            var thisPK = refPK + "_FullData";
//            var mapExt = new Entity("BP.Sys.MapExt", thisPK);
//            var mapAtrr = new Entity("BP.Sys.MapAttr", frmID);
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner_MapExt");
            handler.AddPara("FK_MapData", GetQueryString("FK_MapData"));
            handler.AddPara("Tag", str);
            handler.AddPara("MyPK", thisPK);
            handler.AddPara("AttrOfOper",GetQueryString("KeyOfEn"));
            handler.AddFormData();
            var data = handler.DoMethodReturnString("TBFullCtrlDDL_Save");
            if (data.indexOf('err@') != -1) {
                alert(data);
                return;
            }

            window.location.href = window.location.href;
        }

    </script>
</head>
<body>
    <form id="cc">
    <div id="bar">
    </div>
    
    <div id="doc">
    </div>
    <fieldset>
        <legend>帮助.</legend>
             <ul>
                <li>填充下拉框的SQL, </li>
                <li>必须返回一行数据.</li>
            </ul>
    </fieldset>
</body>
</html>
